package com.xuecheng.content.feignclient;

import com.xuecheng.content.config.MultipartSupportConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author: 35238
 * 功能: xue-content-service模块 远程调用 xue-media-api模块
 * 时间: 2024-06-03 20:29
 */
//下一行的value值要跟huanf-media-api模块的bootstrap.yml文件的spring.application.name值一致
@FeignClient(value = "media-api",configuration = MultipartSupportConfig.class ,fallbackFactory = MediaServiceClientFallbackFactory.class)
@Service
public interface MediaServiceClient {

    //下一行的接口请求地址必须是huanf-media-api模块已存在的接口请求地址
    @PostMapping(value = "/media/upload/coursefile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    String uploadFile(@RequestPart("filedata") MultipartFile upload, @RequestParam(value = "objectName",required=false) String objectName);
}
